{% extends 'base.html' %}
{% from 'bootstrap/form.html' import render_form %}
{% block body %}
    <div class="container-fluid">
        <div class="row">
            {% if user %}
                <div class="col-md-6">
                <div class="row">
                    <div class="col-md-4">
                    <img class="img-thumbnail" style="width: 200px;height: 200px;"
                         src="{{ url_for('static',filename='avatars/'+user.avatar_s) }}">
                    </div>
                    <div class="col-md-8">
                    <h1>{{ user.username }}</h1>
                    <h2>{{ user.email }}</h2>
                    <h3>{{ user.about }}</h3>
                    <h3>{{ user.name }}</h3>
                        {% if current_user == user %}
                    {{ render_form(form,action=request.full_path) }}
                        {% endif %}
                    </div>
                </div>
                <div>

                {% if current_user.id==user.id %}
                     <div class="row">
                        <h3>{{my_his}}的粉丝</h3>
                        <ol class="list-group">
                            {% for fan in fans %}
                                <li class="list-group-item d-flex w-100 justify-content-between">
                                    <a href="{{ url_for('blog.about',user_id=fan.id) }}">
                                    {{ fan.username }}</a>
                                    <button type="button">+关注</button>
                                </li>
                            {% endfor %}
                            {{ render_pagination(pagination_fans) }}
                        </ol>
                    </div>
                {% else %}
                    <p class="warning">您没有权限访问这部分内容</p>
                {% endif %}
                </div>
                </div>
                <div class="col-md-3">
                    <div class="row">
                        <h3>{{ my_his }}的博客</h3>
                        <ul class="list-group">
                            {% for post in posts %}
                            <a href="{{ url_for('blog.show_post',post_id=post.id) }}" class="list-group-item d-flex w-100 justify-content-between">
                                {{ post.title }}
                                <small>{{ moment(post.timestamp).fromNow(refresh=True) }}</small>
                            </a>
                            {% endfor %}
                            {{ render_pagination(pagination) }}
                        </ul>
                    </div>
                </div>
                <div class="col-md-3">
                    <div class="row">
                        <h3>{{ my_his }}的关注</h3>
                        <ol class="list-group">
                            {% for follower in followed %}
                            <a href="{{ url_for('blog.about',user_id=follower.id) }}"
                               class="list-group-item d-flex w-100 justify-content-between">
                                {{ follower.username }}
                                <button type="button">+关注</button>
                            </a>
                            {% endfor %}
                            {{ render_pagination(pagination_follows) }}
                        </ol>
                    </div>
                </div>
            {% endif %}
        </div>
    </div>
{% endblock %}